

<!DOCTYPE html>
<html lang="zh-CN">

<head><meta name="generator" content="Hexo 3.9.0">
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>setMaxLifecycle 上位，setUserVisibleHint 被弃用 - 杨云召 | 博客</title>
  <meta name="apple-mobile-web-app-capable" content="yes">
  <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
  <meta name="google" content="notranslate">

  
  
  <meta name="description" content="setUserVisibleHint 被弃用


很多..."> 
  
  <meta name="author" content="杨云召（Flywith24）"> 

  
    <link rel="icon" href="/images/icons/favicon-16x16.png" type="image/png" sizes="16x16">
  
  
    <link rel="icon" href="/images/icons/favicon-32x32.png" type="image/png" sizes="32x32">
  
  
    <link rel="apple-touch-icon" href="/images/icons/apple-touch-icon.png" sizes="180x180">
  
  
    <meta rel="mask-icon" href="/images/icons/stun-logo.svg" color="#333333">
  
  
    <meta rel="msapplication-TileImage" content="/images/icons/favicon-144x144.png">
    <meta rel="msapplication-TileColor" content="#000000">
  

  <link rel="stylesheet" href="/css/style.css">

  
  <link rel="stylesheet" href="//at.alicdn.com/t/font_1445822_hhodbqn7tit.css">
  

  
  
  <link rel="stylesheet" href="https://cdn.bootcss.com/fancybox/3.5.7/jquery.fancybox.min.css">
  

  
  
  <link rel="stylesheet" href="https://cdn.bootcss.com/highlight.js/9.18.1/styles/xcode.min.css">
  

  <script>
    var CONFIG = window.CONFIG || {};
    var ZHAOO = window.ZHAOO || {};
    CONFIG = {
      isHome: false,
      fancybox: true,
      pjax: false,
      lazyload: {
        enable: true,
        loadingImage: '/images/theme/loading.gif',
      },
      donate: {
        enable: true,
        alipay: 'https://gitee.com/flywith24/Album/raw/master/img/20201015113301.jpg',
        wechat: 'https://gitee.com/flywith24/Album/raw/master/img/20201015112814.png'
      },
      motto: {
        api: '',
        default: '不人云亦云，只求接近真相.'
      },
      galleries: {
        enable: true
      },
      fab: {
        enable: true,
        alwaysShow: false
      },
      carrier: {
        enable: true
      },
      daovoice: {
        enable: true
      }
    }
  </script>

  

  
</head></html>
<body class="lock-screen">
  <div class="loading"></div>
  


<nav class="navbar">
  <div class="left"></div>
  <div class="center">setMaxLifecycle 上位，setUserVisibleHint 被弃用</div>
  <div class="right">
    <i class="iconfont iconmenu j-navbar-menu"></i>
  </div>
</nav>

  <nav class="menu">
  <div class="menu-wrap">
    <div class="menu-close">
      <i class="iconfont iconbaseline-close-px"></i>
    </div>
    <ul class="menu-content">
      
      
      
      
      <li class="menu-item"><a href="/ " class="underline"> 首页</a></li>
      
      
      
      
      <li class="menu-item"><a href="/archives " class="underline"> 归档</a></li>
      
      
      
      
      <li class="menu-item"><a href="/tags " class="underline"> 标签</a></li>
      
      
      
      
      <li class="menu-item"><a href="/categories " class="underline"> 分类</a></li>
      
      
      
      
      <li class="menu-item"><a href="/about " class="underline"> 关于</a></li>
      
    </ul>
    <div class="menu-copyright"><p>Copyright© 2017 - 2020 ❤️ Flywith24</p></div>
  </div>
</nav>
  <main id="main">
  <div class="container" id="container">
    <article class="article">
  <div class="wrap">
    <section class="head">
  <img   class="lazyload" data-original="https://gitee.com/flywith24/Album/raw/master/img/20201015102938.png" src=""  draggable="false">
  <div class="head-mask">
    <h1 class="head-title">setMaxLifecycle 上位，setUserVisibleHint 被弃用</h1>
    <div class="head-info">
      <span class="post-info-item"><i class="iconfont iconcalendar"></i>四月 29, 2020</span
        class="post-info-item">
      
      <span class="post-info-item"><i class="iconfont iconfont-size"></i>1707</span>
    </div>
  </div>
</section>
    <section class="main">
      <section class="content">
        <p>很多情况下，fragment 的生命周期上限应该低于 FragmentManager/Activity。例如，<code>ViewPager</code> 屏幕外的界面不应被 <code>resumed</code></p>
<p>理想状态下，可以通过以下 API 实现</p>
<figure class="highlight kotlin"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><code class="hljs kotlin">supportFragmentManager<br>	  .beginTransaction()<br>      .setMaxLifecycle(fragment, Lifecycle.State.RESUMED)<br>      .commit()<br></code></pre></td></tr></table></figure>

<p>将最大生命周期设置为 <code>Lifecycle.State.RESUMED</code> 将有效地消除限制（因为这是最高生命周期状态）</p>
<p>这将允许废弃 <code>setUserVisibleHint()</code> API</p>
<!-- more-->


<h2 id="setMaxLifecycle-出现始末"><a href="#setMaxLifecycle-出现始末" class="headerlink" title="setMaxLifecycle 出现始末"></a>setMaxLifecycle 出现始末</h2><p>该功能应如何实现的？我们沿着 <code>commit log</code> 来理一下官方的思路</p>
<p>将 <code>BackStackRecord</code> 的部分逻辑转移至父类 <code>FragmentTransaction</code> 中</p>
<p><img class="lazyload" data-original="https://gitee.com/flywith24/Album/raw/master/img/20200423094356.png" src="/2020/04/29/Jetpack-fragment-setMaxLifecycle/gif;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVQImWNgYGBgAAAABQABh6FO1AAAAABJRU5ErkJggg==" alt></p>
<p><img class="lazyload" data-original="https://gitee.com/flywith24/Album/raw/master/img/20200423101522.png" src="/2020/04/29/Jetpack-fragment-setMaxLifecycle/gif;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVQImWNgYGBgAAAABQABh6FO1AAAAABJRU5ErkJggg==" alt></p>
<p>在 <code>FragmentTransaction</code> 中添加 <code>setMaxLifecycle</code> API</p>
<p><img class="lazyload" data-original="https://gitee.com/flywith24/Album/raw/master/img/20200423101908.png" src="/2020/04/29/Jetpack-fragment-setMaxLifecycle/gif;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVQImWNgYGBgAAAABQABh6FO1AAAAABJRU5ErkJggg==" alt></p>
<p><img class="lazyload" data-original="https://gitee.com/flywith24/Album/raw/master/img/20200423102052.png" src="/2020/04/29/Jetpack-fragment-setMaxLifecycle/gif;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVQImWNgYGBgAAAABQABh6FO1AAAAABJRU5ErkJggg==" alt></p>
<p>保存 fragment <code>maxState</code></p>
<p><img class="lazyload" data-original="https://gitee.com/flywith24/Album/raw/master/img/20200423103245.png" src="/2020/04/29/Jetpack-fragment-setMaxLifecycle/gif;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVQImWNgYGBgAAAABQABh6FO1AAAAABJRU5ErkJggg==" alt></p>
<p><img class="lazyload" data-original="https://gitee.com/flywith24/Album/raw/master/img/20200423103057.png" src="/2020/04/29/Jetpack-fragment-setMaxLifecycle/gif;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVQImWNgYGBgAAAABQABh6FO1AAAAABJRU5ErkJggg==" alt></p>
<p>弃用 <code>setUserVisibleHint</code></p>
<p><img class="lazyload" data-original="https://gitee.com/flywith24/Album/raw/master/img/20200423103528.png" src="/2020/04/29/Jetpack-fragment-setMaxLifecycle/gif;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVQImWNgYGBgAAAABQABh6FO1AAAAABJRU5ErkJggg==" alt></p>
<p><code>FragmentPagerAdapter</code> 构造器新增参数，使用 <code>setMaxLifecycle()</code> API 确保 fragment <code>resumed</code> 时对用户可见</p>
<p><img class="lazyload" data-original="https://gitee.com/flywith24/Album/raw/master/img/20200423104355.png" src="/2020/04/29/Jetpack-fragment-setMaxLifecycle/gif;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVQImWNgYGBgAAAABQABh6FO1AAAAABJRU5ErkJggg==" alt></p>
<p><img class="lazyload" data-original="https://gitee.com/flywith24/Album/raw/master/img/20200423104634.png" src="/2020/04/29/Jetpack-fragment-setMaxLifecycle/gif;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVQImWNgYGBgAAAABQABh6FO1AAAAABJRU5ErkJggg==" alt></p>
<p>弃用 <code>FragmentStatePagerAdapter</code> 原来的单参构造器，推荐使用新的构造</p>
<p><img class="lazyload" data-original="https://gitee.com/flywith24/Album/raw/master/img/20200423105038.png" src="/2020/04/29/Jetpack-fragment-setMaxLifecycle/gif;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVQImWNgYGBgAAAABQABh6FO1AAAAABJRU5ErkJggg==" alt></p>
<p><img class="lazyload" data-original="https://gitee.com/flywith24/Album/raw/master/img/20200423105144.png" src="/2020/04/29/Jetpack-fragment-setMaxLifecycle/gif;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVQImWNgYGBgAAAABQABh6FO1AAAAABJRU5ErkJggg==" alt></p>
<p><strong>随着 <code>ViewPager2 1.0.0</code> 正式版发布，与 <code>ViewPager</code> 交互的<code>FragmentPagerAdapter</code> 和 <code>FragmentStatePagerAdapter</code> 被弃用了</strong></p>
<p><img class="lazyload" data-original="https://gitee.com/flywith24/Album/raw/master/img/20200423111201.png" src="/2020/04/29/Jetpack-fragment-setMaxLifecycle/gif;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVQImWNgYGBgAAAABQABh6FO1AAAAABJRU5ErkJggg==" alt></p>
<p>至此我们捋顺了 <code>setMaxLifecycle</code> 的出现，<code>setUserVisibleHint</code> 的弃用以及与<code>ViewPager</code> 相关的 <code>FragmentPagerAdapter</code> 和 <code>FragmentStatePagerAdapter</code> 的弃用</p>
<h2 id="setMaxLifecycle-内部逻辑"><a href="#setMaxLifecycle-内部逻辑" class="headerlink" title="setMaxLifecycle 内部逻辑"></a>setMaxLifecycle 内部逻辑</h2><p>接下来我们看看 <code>setMaxLifecycle</code>  是如何发挥作用的</p>
<p>首先我们要研究一下 fragment 的状态管理，为了更好的管理 fragment 的状态，官方添加了 <code>FragmentStateManager</code> 类来专门管理 fragment 的状态，职能单一原则哈</p>
<p><img class="lazyload" data-original="https://gitee.com/flywith24/Album/raw/master/img/20200423113312.png" src="/2020/04/29/Jetpack-fragment-setMaxLifecycle/gif;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVQImWNgYGBgAAAABQABh6FO1AAAAABJRU5ErkJggg==" alt></p>
<p><img class="lazyload" data-original="https://gitee.com/flywith24/Album/raw/master/img/20200423113509.png" src="/2020/04/29/Jetpack-fragment-setMaxLifecycle/gif;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVQImWNgYGBgAAAABQABh6FO1AAAAABJRU5ErkJggg==" alt></p>
<p>接着在该类中添加了计算 fragment 最大生命周期的方法 <code>computeMaxState()</code> </p>
<p><img class="lazyload" data-original="https://gitee.com/flywith24/Album/raw/master/img/20200423114557.png" src="/2020/04/29/Jetpack-fragment-setMaxLifecycle/gif;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVQImWNgYGBgAAAABQABh6FO1AAAAABJRU5ErkJggg==" alt></p>
<p><img class="lazyload" data-original="https://gitee.com/flywith24/Album/raw/master/img/20200423114615.png" src="/2020/04/29/Jetpack-fragment-setMaxLifecycle/gif;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVQImWNgYGBgAAAABQABh6FO1AAAAABJRU5ErkJggg==" alt></p>
<p>后来该方法改名为 <code>computeExpectedState()</code> 并加入了 <code>moveToExpectedState()</code> 方法</p>
<p><img class="lazyload" data-original="https://gitee.com/flywith24/Album/raw/master/img/20200423115055.png" src="/2020/04/29/Jetpack-fragment-setMaxLifecycle/gif;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVQImWNgYGBgAAAABQABh6FO1AAAAABJRU5ErkJggg==" alt></p>
<p><code>computeExpectedState()</code>  方法会根据 fragment <code>mMaxState</code> 计算 fragment 应该所处的生命周期</p>
<p><img class="lazyload" data-original="https://gitee.com/flywith24/Album/raw/master/img/20200423115521.png" src="/2020/04/29/Jetpack-fragment-setMaxLifecycle/gif;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVQImWNgYGBgAAAABQABh6FO1AAAAABJRU5ErkJggg==" alt></p>
<p>而 fragment 的 <code>mMaxState</code> 是通过 <code>FragmentManager</code> 的 <code>setMaxLifecycle()</code> 方法设置的 ，而该方法是 <code>BackStackRecord</code> 执行 OP 时调用的，而 OP 值正是通过 <code>FragmentTransaction</code> 的 <code>setMaxLifecycle()</code> 设置的</p>
<p><img class="lazyload" data-original="https://gitee.com/flywith24/Album/raw/master/img/20200423115744.png" src="/2020/04/29/Jetpack-fragment-setMaxLifecycle/gif;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVQImWNgYGBgAAAABQABh6FO1AAAAABJRU5ErkJggg==" alt></p>
<p><img class="lazyload" data-original="https://gitee.com/flywith24/Album/raw/master/img/20200423115928.png" src="/2020/04/29/Jetpack-fragment-setMaxLifecycle/gif;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVQImWNgYGBgAAAABQABh6FO1AAAAABJRU5ErkJggg==" alt></p>
<p>至此，我们理清了 <code>setMaxLifecycle()</code> 的内部逻辑</p>
<h2 id="总结"><a href="#总结" class="headerlink" title="总结"></a>总结</h2><p>我们可以看到官方为了使 fragment 能够在正确的生命周期上，引入了 <code>setMaxLifecycle()</code> 方法，同时为了更好的管理 fragment 的状态，抽象出了 <code>FragmentStateManager</code> 。<em>更少的代码，更少的职责</em>，fragment 的内部逻辑会越来越清晰</p>
<ul>
<li><p>关于如何迁移至 ViewPager2 ，请移步 <a href="https://www.bilibili.com/video/BV1uJ411C7S4?from=search&seid=7755962876168902731" target="_blank" rel="noopener">官方视频</a></p>
</li>
<li><p>关于新的 API 下懒加载实现，请移步 <a href="https://juejin.im/post/5e232d01e51d455801624c06" target="_blank" rel="noopener">Androidx 下 Fragment 懒加载的新实现</a></p>
</li>
</ul>
<h2 id="关于我"><a href="#关于我" class="headerlink" title="关于我"></a>关于我</h2><p>我是 <a href="https://flywith24.gitee.io/">Fly_with24</a></p>
<ul>
<li><p><a href="https://juejin.im/user/57c7f6870a2b58006b1cfd6c" target="_blank" rel="noopener">掘金</a></p>
</li>
<li><p><a href="https://www.jianshu.com/u/3d5ad6043d66" target="_blank" rel="noopener">简书</a></p>
</li>
<li><p><a href="https://github.com/Flywith24" target="_blank" rel="noopener">Github</a></p>
</li>
</ul>
<center><p> 欢迎关注我的公众号</p></center>

<div align="center"><img class="lazyload" data-original="https://gitee.com/flywith24/Album/raw/master/img/20200429102625.jpg" src="/2020/04/29/Jetpack-fragment-setMaxLifecycle/gif;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVQImWNgYGBgAAAABQABh6FO1AAAAABJRU5ErkJggg=="></div>
      </section>
      <section class="extra">
        
        <ul class="copyright">
  
  <li><strong>本文作者：</strong>杨云召（Flywith24）</li>
  <li><strong>本文链接：</strong><a href="https://flywith24.gitee.io/2020/04/29/Jetpack-fragment-setMaxLifecycle/index.html">https://flywith24.gitee.io/2020/04/29/Jetpack-fragment-setMaxLifecycle/index.html</a></li>
  <li><strong>版权声明：</strong>本博客所有文章均采用<a href="https://creativecommons.org/licenses/by-nc-sa/4.0/deed.zh"
      rel="external nofollow" target="_blank"> BY-NC-SA </a>许可协议，转载请注明出处！</li>
  
</ul>
        
        
        <section class="donate">
  <div class="qrcode">
    <img   class="lazyload" data-original="https://gitee.com/flywith24/Album/raw/master/img/20201015113301.jpg" src="" >
  </div>
  <div class="icon">
    <a href="javascript:;" id="alipay"><i class="iconfont iconalipay"></i></a>
    <a href="javascript:;" id="wechat"><i class="iconfont iconwechat-fill"></i></a>
  </div>
</section>
        
        
  <ul class="tag-list"><li class="tag-list-item"><a class="tag-list-link" href="/tags/Fragment/">Fragment</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/Jetpack/">Jetpack</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/MVVM/">MVVM</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/androidx/">androidx</a></li></ul>

        
<nav class="nav">
  
    <a href="/2020/04/30/Jetpack-fragment-ResultAPI/"><i class="iconfont iconleft"></i>1.3.0-alpha04 来袭，Fragment 间通信的新姿势</a>
  
  
    <a href="/2020/04/15/Tips-includeBuild/">除了 buildSrc 还能这样统一配置依赖版本？巧用 includeBuild<i class="iconfont iconright"></i></a>
  
</nav>

      </section>
      
      <section class="comments">
  
  <div class="btn" id="comments-btn">查看评论</div>
  
  
<div id="valine"></div>
<script defer src="//unpkg.com/valine/dist/Valine.min.js"></script>
<script>
  window.onload = function () {
    var loadValine = function () {
      new Valine({
        el: '#valine',
        app_id: "SHA3gzCcxFlqaPcGRnX4UgET-gzGzoHsz",
        app_key: "OYo7ITS4AzTvBUvb1yIY8oaf",
        placeholder: "期待你的留言",
        avatar: "mp",
        pageSize: "10",
        lang: "zh-CN",
      });
    }
    if ( true ) {
      $("#comments-btn").on("click", function () {
        $(this).hide();
        loadValine();
      });
    } else {
      loadValine();
    }
  };
</script>

</section>
      
    </section>
  </div>
</article>
  </div>
</main>
  <footer class="footer">
  <div class="footer-social">
    
    
    
    
    
    <a href="tencent://message/?Menu=yes&uin=1032367864 " target="_blank" onMouseOver="this.style.color= '#12B7F5'"
      onMouseOut="this.style.color='#33333D'">
      <i class="iconfont footer-social-item  iconQQ "></i>
    </a>
    
    
    
    
    
    <a href="javascript:; " target="_blank" onMouseOver="this.style.color= '#8bc34a'"
      onMouseOut="this.style.color='#33333D'">
      <i class="iconfont footer-social-item  iconwechat-fill "></i>
    </a>
    
    
    
    
    
    <a href="https://flywith24.gitee.io/about/ " target="_blank" onMouseOver="this.style.color= '#d32f2f'"
      onMouseOut="this.style.color='#33333D'">
      <i class="iconfont footer-social-item  iconheart "></i>
    </a>
    
    
    
    
    
    <a href="https://github.com/Flywith24 " target="_blank" onMouseOver="this.style.color= '#24292E'"
      onMouseOut="this.style.color='#33333D'">
      <i class="iconfont footer-social-item  icongithub-fill "></i>
    </a>
    
    
    
    
    
    <a href="mailto:youngyunzhao@163.com " target="_blank" onMouseOver="this.style.color='#FFBE5B'"
      onMouseOut="this.style.color='#33333D'">
      <i class="iconfont footer-social-item  iconmail"></i>
    </a>
    
  </div>
  <div class="footer-copyright"><p>Copyright© 2017 - 2020 ❤️ Flywith24</p></div>
</footer>
  
      <div class="fab fab-plus">
    <i class="iconfont iconplus"></i>
  </div>
  
  <div class="fab fab-daovoice">
    <i class="iconfont iconcomment"></i>
  </div>
  
  <div class="fab fab-up">
    <i class="iconfont iconcaret-up"></i>
  </div>
  
<script src="/live2dw/lib/L2Dwidget.min.js?094cbace49a39548bed64abff5988b05"></script><script>L2Dwidget.init({"pluginRootPath":"live2dw/","pluginJsPath":"lib/","pluginModelPath":"assets/","tagMode":false,"debug":false,"model":{"jsonPath":"/live2dw/assets/shizuku.model.json"},"display":{"position":"left","width":150,"height":300},"mobile":{"show":"tfalse"},"log":false});</script></body>

<script src="https://cdn.bootcss.com/jquery/3.4.1/jquery.min.js"></script>




<script src="https://cdn.bootcdn.net/ajax/libs/jquery.lazyload/1.9.1/jquery.lazyload.min.js"></script>




<script src="https://cdn.bootcss.com/fancybox/3.5.7/jquery.fancybox.min.js"></script>




<script src="/js/utils.js"></script>
<script src="/js/modules.js"></script>
<script src="/js/zui.js"></script>
<script src="/js/script.js"></script>




<script>
  (function (i, s, o, g, r, a, m) {
    i["DaoVoiceObject"] = r;
    i[r] = i[r] || function () {
      (i[r].q = i[r].q || []).push(arguments)
    }, i[r].l = 1 * new Date();
    a = s.createElement(o), m = s.getElementsByTagName(o)[0];
    a.async = 1;
    a.src = g;
    a.charset = "utf-8";
    m.parentNode.insertBefore(a, m)
  })(window, document, "script", ('https:' == document.location.protocol ? 'https:' : 'http:') +
    "//widget.daovoice.io/widget/0f81ff2f.js", "daovoice")
  daovoice('init', {
    app_id: "7785620b"
  }, {
    launcher: {
      disableLauncherIcon: true,
    },
  });
  daovoice('update');
</script>



<script>
  (function () {
    var bp = document.createElement('script');
    var curProtocol = window.location.protocol.split(':')[0];
    if (curProtocol === 'https') {
      bp.src = 'https://zz.bdstatic.com/linksubmit/push.js';
    } else {
      bp.src = 'http://push.zhanzhang.baidu.com/push.js';
    }
    var s = document.getElementsByTagName("script")[0];
    s.parentNode.insertBefore(bp, s);
  })();
</script>


<script>
  var _hmt = _hmt || [];
  (function () {
    var hm = document.createElement("script");
    hm.src = "https://hm.baidu.com/hm.js?4c204d8bc027a0455b5fc642ac334ca8";
    var s = document.getElementsByTagName("script")[0];
    s.parentNode.insertBefore(hm, s);
  })();
</script>










</html>